package com.yili.common.view

import android.app.Dialog
import android.content.Context
import com.android.tu.loadingdialog.LoadingDailog

/**
 *  @Description：
 *  @author：weishixiong
 *  @date：2023-05-05 10:26
 *
 */
object FragmentProgressDialog {
    var dialog: Dialog? = null

    fun show(context: Context,title:String?= "请稍后...") {
        if(dialog!=null&& dialog!!.isShowing){
            dialog?.dismiss()
        }
        runCatching {
            val loadBuilder = LoadingDailog.Builder(context)
                .setMessage(title)
                .setCancelable(true)
                .setCancelOutside(true)
            dialog = loadBuilder.create()
            dialog?.show()
        }
    }

    fun hide() {
        runCatching {
            dialog?.dismiss()
        }

    }

}